//
//  buttonitem.m
//  mymovie01
//
//  Created by imac on 15/8/19.
//  Copyright (c) 2015年 czd. All rights reserved.
//

#import "buttonitem.h"

@implementation buttonitem

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (self) {
        _titleImageView = [[UIImageView alloc] initWithFrame:CGRectMake((self.width - 19) / 2, 7, 19, 20)];
        _titleImageView.contentMode = UIViewContentModeScaleAspectFit;

        [self addSubview:_titleImageView];
        
        // 2.创建标题文本
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _titleImageView.bottom + 3, self.width, 12)];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.textColor = [UIColor grayColor];
        _titleLabel.font = [UIFont systemFontOfSize:10];
        [self addSubview:_titleLabel];
    }
    return self;

}
// 设置标题文本
- (void)setTitle:(NSString *)title
{
    _titleLabel.text = title;
}
// 设置标题图片
- (void)setTitleImage:(UIImage *)titleImage
{
    _titleImageView.image = titleImage;
}



@end
